package com.prasanna.practice 
{
	import com.prasanna.practice.controller.ParserController;
	import com.prasanna.practice.controller.ViewController;
	import com.prasanna.practice.model.Model;
	import com.prasanna.practice.utils.XmlLoader;
	import com.prasanna.practice.utils.XmlLoaderEvent;
	import flash.display.MovieClip;
	
	/**
	 * ...
	 * @author Prasanna Patra
	 * 
	 * com.prasanna.practice.MyDocMc
	 */
	public class MyDocMc extends MovieClip 
	{
		private var model:Model = Model.instance;
		private var tcContainerMc:MovieClip;
		
		public function MyDocMc() 
		{
			assignvars()
		}
		
		private function assignvars():void 
		{
			tcContainerMc = this["tcContainer_mc"] as MovieClip;
			var viewController:ViewController = new ViewController();
			var parserController:ParserController = new ParserController();
			model.viewController = viewController;
			model.parserController = parserController;
			model.viewController.tcContainerMc = tcContainerMc;
			
			var xmlPath:String = "mylist.xml";
			
			var xmlLoder:XmlLoader = new XmlLoader();
			xmlLoder.addEventListener(XmlLoaderEvent.XML_LOADED, xmlLoder_xmlLoaded);
			xmlLoder.LoadXML(xmlPath);
		}
		
		private function xmlLoder_xmlLoaded(e:XmlLoaderEvent):void 
		{
			trace("pp-xmlLoder_xmlLoaded e.xmlData :: " + e.xmlData);
			model.parserController.parseXmlData(e.xmlData);
			model.viewController.populateData();
		}
		
	}

}